---
# tasklist for setting up the backup server.
- name: install bacula
  yum: pkg=$item state=installed
  with_items:
  - bacula-director-mysql
  - bacula-console
  - bacula-client
  - mysql-server
  - mtx
  tags:
  - packages

# install bacula config files. 
- name: install bacula storage director configs
  template: src=$files/bacula/bacula-sd.conf.j2 dest=/etc/bacula/bacula-sd.conf mode=640
  notify:
  - restart bacula-sd
  tags:
  - config

- name: install bacula director configs
  template: src=$files/bacula/bacula-dir.conf.j2 dest=/etc/bacula/bacula-dir.conf mode=640
  notify:
  - restart bacula-dir
  tags:
  - config

- name: install bacula file configs
  template: src=$files/bacula/bacula-fd.conf.j2 dest=/etc/bacula/bacula-fd.conf mode=640
  notify:
  - restart bacula-fd
  tags:
  - config

- name: install bacula console config
  template: src=$files/bacula/bconsole.conf.j2 dest=/etc/bacula/bconsole.conf mode=640
  tags:
  - config

- name: install bacula scripts
  copy: src=$files/bacula/$item dest=/usr/local/bin/$item mode=0755
  with_items:
  - fedora_make_catalog_backup
  - fedora_delete_catalog_backup
  tags:
  - config

- name: enable bacula-sd service
  service: name=bacula-sd state=started enabled=yes

- name: enable bacula-dir service
  service: name=bacula-dir state=started enabled=yes

- name: enable bacula-fd service
  service: name=bacula-fd state=started enabled=yes
